package com.home.cop.sysinfo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.home.cop.sysinfo.mapper.IndustryMapper;
import com.home.cop.sysinfo.model.Industry;
import com.home.cop.sysinfo.service.IndustryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;


@Service
public class IndustryServiceImpl implements IndustryService {

    @Autowired
    private IndustryMapper industryMapper;

    @Override
    public PageInfo<Industry> list(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(industryMapper.list());
    }

    @Transactional
    @Override
    public void delete(Integer indId) {
        industryMapper.deleteByPrimaryKey(indId);
    }

    @Transactional
    @Override
    public void insert(Industry industry) {
        industryMapper.insertSelective(industry);
    }

    @Transactional
    @Override
    public void update(Industry industry) {
        industryMapper.updateByPrimaryKeySelective(industry);
    }
}
